{extend name="layout/main-block" /}
<!-- main content start -->
{block name="content"}
<section id="main-content">
    <section class="wrapper">
        <div class="row">
            <ol class="breadcrumb">
                <li class="h4"><a href="">{$menu_name}</a></li>
            </ol>
        </div>
        <div class="row col-sm-2" style="margin-bottom: 20px;">
            <a href="{:url('lists/lists_create',['type'=>$type,'id'=>$id])}" class="btn btn-primary" role="button">添加</a>
        </div>
        <div class="row col-sm-3">
            <select class="form-control" name="nav-select" id="nav-select" onchange="changeSelect(this)">
                {volist name="tab_select" id="v" empty="$empty" }
                <option {if condition="$v.tab_id eq $tab_id"} selected {/if} id="input-option" value="{$v.tab_id}">{$v.tab_name_cn}</option>
                {/volist}
            </select>
        </div>

        <div class="row content-main">
            <div class="col-sm-12">
                <form action="">
                    <table class="table table-striped">
                        <tr>
                            <th>id</th>
                            <th>{$xw}名称中文</th>
                            <th>{$xw}名称英文</th>
                            <th class="newsneed">{$xw}简介中文</th>
                            <th class="newsneed">{$xw}简介英文</th>
                            <th class="newsneed">{$xw}图片</th>
                            <th>操作</th>
                        </tr>
                        {volist name="lists" id="v" empty="$empty" }
                        <tr>
                            <td>{$v.list_id}</td>
                            <td>{$v.list_title_cn}</td>
                            <td>{$v.list_title_en |mb_substr=0,10}</td>
                            {if condition="$v.type_id eq 1"}
                            <td>{$v.title_introduce_cn |mb_substr=0,10}</td>
                            <td>{$v.title_introduce_en |mb_substr=0,10}</td>
                            <td>
                                {if condition="$v.img_url neq ''" }
                                <img src="{$v.img_url}" alt="" width="100">
                                {/if}
                            </td>
                           {/if}
                            <td class="operation">
                                <a class="btn btn-info btn-xs" href="{:url('lists/lists_update', ['type'=>$type,'list_id'=>$v.list_id])}"><i class="glyphicon glyphicon-edit"></i>修改名称</a>
                                {if condition="$v.flag eq 1"}
                                <a class="btn btn-primary btn-xs" href="{:url('stage/stage_update', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-edit"></i>修改内容</a>
                                {else/}
                                <a class="btn btn-primary btn-xs"  href="{:url('stage/stage_create', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-plus"></i>添加内容</a>
                                {/if}
                                <a class="btn btn-danger btn-xs" href="{:url('lists/lists_delete', ['type'=>$type,'list_id'=>$v.list_id])}" onclick="return confirm('确定要删除吗？');"><i class="glyphicon glyphicon-remove"></i>删除</a>

                                <!--<a class="btn btn-warning btn-xs" href="{:url('stage/stage_delete', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-remove"></i>删除内容</a>-->
                                {if condition="$v.type_id eq 1"}
                                <!--<a class="btn btn-default btn-xs" href="{:url('lists/lists_stick', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-eye-open"></i>预览</a>-->
                                {if condition="$v.is_enable eq 0"}
                                <a class="btn btn-success btn-xs" href="{:url('lists/is_enable', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-ok-circle"></i>发布</a>
                                {elseif condition="$v.is_enable eq 1"/}
                                <a class="btn btn-success btn-xs" href="{:url('lists/isnot_enable', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-remove-circle"></i>取消发布</a>
                                {/if}
                                {if condition="substr($v.is_recommend,0,1) eq 0"}
                                <a class="btn btn-warning btn-xs" href="{:url('lists/lists_stick', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-arrow-up"></i>置顶</a>
                                {else/}
                                <a class="btn btn-warning btn-xs" href="{:url('lists/lists_outstick', ['type'=>$type,'list_id'=>$v.list_id])}" ><i class="glyphicon glyphicon-arrow-down"></i>取消置顶</a>
                                {/if}
                                {/if}


                            </td>
                        </tr>
                        {/volist}

                    </table>
                </form>
            </div>
        </div>
        {$page}
    </section>
</section>
{/block}

{block name="javascript"}
    <script type="text/javascript" src="/static/js/common.js"></script>
    <script type="text/javascript">
//select 下拉菜单显示对应内容
            function changeSelect(obj) {
                // window.location.href = window.location.href.refQueryValue('tab_id',$(obj).val());
                var url = window.location.href;
                url = url.refQueryValue('tab_id',$(obj).val());
                window.location.href = url.refQueryValue('page',1);
            }
            //隐藏news需要的字段
            $(function () {
                var type = '{$type}';
                //console.log($(".newsneed"));
               if (type== "articles") {
                    $(".newsneed").css("display", "none");//隐藏div
                }
            });

    </script>
{/block}